babl: strip out some internal length returning code
authorØyvind Kolås <pippin@gimp.org>
Sat, 6 Jan 2018 23:42:33 +0000 (00:42 +0100)
committerØyvind Kolås <pippin@gimp.org>
Sun, 7 Jan 2018 00:03:38 +0000 (01:03 +0100)
babl/babl-conversion.c
babl/babl-fish-path.c
babl/babl-fish-reference.c
babl/babl-internal.h

index 17dccf862aba6bacf3b041806fb85b2b1a5751b9..b9df9af3c6cce90002fc774fbd9c691f84cb2328 100644 (file)
@@ -359,7 +359,7 @@ babl_conversion_planar_process (BablConversion *conversion,
                                       conversion->data);
 }
 
-long
+void
 babl_conversion_process (const Babl *babl,
                          const char *source,
                          char       *destination,
@@ -436,13 +436,11 @@ babl_conversion_process (const Babl *babl,
         babl_log ("args=(%s, %p, %p, %li) unhandled conversion type: %s",
                   conversion->instance.name, source, destination, n,
                   babl_class_name (conversion->instance.class_type));
-        return 0;
         break;
     }
 
   conversion->processings++;
   conversion->pixels += n;
-  return n;
 }
 
 long
index 7878c1ceafd6be0686a63c0f0b45e3e0728ae8cb..2d8bd9ec49d5df54b2acf567058cc79fccaefbe3 100644 (file)
@@ -74,7 +74,7 @@ get_path_instrumentation (FishPathInstrumentation *fpi,
                           double                  *path_error);
 
 
-static long
+static void
 process_conversion_path (BablList   *path,
                          const void *source_buffer,
                          int         source_bpp,
@@ -607,7 +607,7 @@ babl_fish_path (const Babl *source,
   return babl_fish_path2 (source, destination, 0.0);
 }
 
-static long
+static void
 babl_fish_path_process (const Babl *babl,
                         const void *source,
                         void       *destination,
@@ -642,41 +642,38 @@ babl_fish_path_process (const Babl *babl,
          babl_log ("-eeek{%i}\n", babl_dest->instance.class_type - BABL_MAGIC);
      }
 
-  return process_conversion_path (babl->fish_path.conversion_list,
-                                  source,
-                                  source_bpp,
-                                  destination,
-                                  dest_bpp,
-                                  n);
+  process_conversion_path (babl->fish_path.conversion_list,
+                           source,
+                           source_bpp,
+                           destination,
+                           dest_bpp,
+                           n);
 }
 
-static long
+static void
 _babl_fish_process (const Babl *babl,
                     const void *source,
                     void       *destination,
                     long        n)
 {
-  long ret = 0;
-
   switch (babl->class_type)
     {
       case BABL_FISH_REFERENCE:
         if (babl->fish.source == babl->fish.destination)
           { /* XXX: we're assuming linear buffers */
             memcpy (destination, source, n * babl->fish.source->format.bytes_per_pixel);
-            ret = n;
           }
         else
           {
-            ret = babl_fish_reference_process (babl, source, destination, n);
+            babl_fish_reference_process (babl, source, destination, n);
           }
         break;
 
       case BABL_FISH_SIMPLE:
         if (BABL (babl->fish_simple.conversion)->class_type == BABL_CONVERSION_LINEAR)
           {
-            ret = babl_conversion_process (BABL (babl->fish_simple.conversion),
-                                           source, destination, n);
+            babl_conversion_process (BABL (babl->fish_simple.conversion),
+                                     source, destination, n);
           }
         else
           {
@@ -685,30 +682,28 @@ _babl_fish_process (const Babl *babl,
         break;
 
       case BABL_FISH_PATH:
-        ret = babl_fish_path_process (babl, source, destination, n);
+        babl_fish_path_process (babl, source, destination, n);
         break;
 
       default:
         babl_log ("NYI");
-        ret = -1;
         break;
     }
-  return ret;
 }
 
-long
+void
 babl_fish_process (const Babl *babl,
                    const void *source,
                    void       *destination,
                    long        n);
 
-long
+void
 babl_fish_process (const Babl *babl,
                    const void *source,
                    void       *destination,
                    long        n)
 {
-  return _babl_fish_process (babl, source, destination, n);
+  _babl_fish_process (babl, source, destination, n);
 }
 
 long
@@ -718,10 +713,9 @@ babl_process (const Babl *cbabl,
               long        n)
 {
   Babl *babl = (Babl*)cbabl;
-  babl_assert (babl);
+  babl_assert (babl && BABL_IS_BABL (babl));
   babl_assert (source);
   babl_assert (destination);
-  babl_assert (BABL_IS_BABL (babl));
   if (n == 0)
     return 0;
   babl_assert (n > 0);
@@ -731,15 +725,18 @@ babl_process (const Babl *cbabl,
       babl->class_type <= BABL_FISH_PATH)
     {
       babl->fish.processings++;
-      babl->fish.pixels +=
-             _babl_fish_process (babl, source, destination, n);
+      babl->fish.pixels += n;
+      _babl_fish_process (babl, source, destination, n);
       return n;
     }
 
   /* matches all conversion classes */
   if (babl->class_type >= BABL_CONVERSION &&
       babl->class_type <= BABL_CONVERSION_PLANAR)
-    return babl_conversion_process (babl, source, destination, n);
+  {
+    babl_conversion_process (babl, source, destination, n);
+    return n;
+  }
 
   babl_fatal ("eek");
   return -1;
@@ -755,7 +752,7 @@ static void inline *align_16 (unsigned char *ret)
   return ret;
 }
 
-static long
+static void
 process_conversion_path (BablList   *path,
                          const void *source_buffer,
                          int         source_bpp,
@@ -823,8 +820,6 @@ process_conversion_path (BablList   *path,
                                    c);
         }
   }
-
-  return n;
 }
 
 static void
index 96be9acdd8a06a404ccb22a418b3640862314597..a018566e534de00ac53eecc3f144cafc842b0fbb 100644 (file)
@@ -388,7 +388,7 @@ process_to_n_component (const Babl  *babl,
   return 0;
 }
 
-static int
+static void
 process_same_model (const Babl  *babl,
                     const char *source,
                     char       *destination,
@@ -438,10 +438,9 @@ process_same_model (const Babl  *babl,
       );
     }
   babl_free (double_buf);
-  return 0;
 }
 
-long
+void
 babl_fish_reference_process (const Babl *babl,
                              const char *source,
                              char       *destination,
@@ -459,11 +458,15 @@ babl_fish_reference_process (const Babl *babl,
       (BABL (babl->fish.source)->format.space ==
        BABL (babl->fish.destination)->format.space)
       )
-    return process_same_model (babl, source, destination, n);
+  {
+    process_same_model (babl, source, destination, n);
+    return;
+  }
 
   if (babl_format_is_format_n (BABL (babl->fish.destination)))
   {
-    return process_to_n_component (babl, source, destination, n);
+    process_to_n_component (babl, source, destination, n);
+    return;
   }
 
   source_double_buf = babl_malloc (sizeof (double) * n *
@@ -561,5 +564,4 @@ babl_fish_reference_process (const Babl *babl,
   babl_free (destination_double_buf);
   babl_free (rgba_double_buf);
   babl_free (source_double_buf);
-  return n;
 }
index 3362563cec431f1de23d3e6326265db32222d509..f7d001f60216d1c07bb44866d418f76e51fae52e 100644 (file)
@@ -66,7 +66,7 @@ Babl *   babl_conversion_find           (const void     *source,
                                          const void     *destination);
 double   babl_conversion_error          (BablConversion *conversion);
 long     babl_conversion_cost           (BablConversion *conversion);
-long     babl_conversion_process        (const Babl     *conversion,
+void     babl_conversion_process        (const Babl     *conversion,
                                          const char     *source,
                                          char           *destination,
                                          long            n);
@@ -79,7 +79,7 @@ void     babl_set_extender              (Babl           *new_extender);
 Babl   * babl_extension_quiet_log       (void);
 void     babl_extension_deinit          (void);
 
-long     babl_fish_reference_process    (const Babl *babl,
+void     babl_fish_reference_process    (const Babl *babl,
                                          const char *source,
                                          char       *destination,
                                          long        n);